﻿using System.Linq;
using System.Web.Mvc;
using MovieAPI.Models;

namespace MovieAPI.Controllers
{

    public class HomeController : Controller
    {
        
        public ActionResult Index()
        {
            if (Session["User"]==null)
            {
               return RedirectToAction("Login");
            }
            return View();
        }
        [HttpPost]
        public ActionResult Login(string LoginName,string LoginPwd)
        {
            using (filmEntities db = new filmEntities())
            {
                var User = db.Admin.Where(A => A.AdminAccount == LoginName && A.AdminPwd == LoginPwd).FirstOrDefault();
                if (User!=null)
                {
                    return Json(1, JsonRequestBehavior.AllowGet);
                }
                return Json(0, JsonRequestBehavior.AllowGet);
            }
                 
        }
       public ActionResult MovieInfo()
        {
            return View();
        }
        public ActionResult Login()
        {
            return View();
        }
        public ActionResult HallInfo()
        {
            return View();
        }
        public ActionResult OrderInfo()
        {
            return View();
        }
        public ActionResult Echarts()
        {
            return View();
        }
    }
}

